package com.example.seed.util;

/**
 * Created by lianbone on 2019/9/3.
 * Desc: 字符串工具
 */
public class StringLengthUtil {

    /**
     * 超长截取
     *
     * @param str
     * @param length
     * @return
     */
    public static String sub(String str, int length) {
        if (str == null) {
            return null;
        }
        if (str.length() <= length) {
            return str;
        } else {
            return str.substring(0, length);
        }
    }
}
